# !/usr/bin/python
# -*- coding: utf-8 -*-
'''
@File    :   01_abc.py
@Time    :   2021/03/21 16:34:37
@Author  :   Qingxiang Zhang
@Version :   1.0
@Contact :   344285081@qq.com
@Desc    :   数据结构第一题
@Software:    Vscode
'''
# 题目
'''如果 a+b+c=1000，且 a^2+b^2=c^2（a,b,c 为自然数），如何求出所有a、b、c可能的组合?'''

import time

start_time=time.time()

for a in range(0,1001):
    for b in range(0,1001):
        c=1000-b-a
        if a**2+b**2==(1000-a-b)**2:
            print("a=",a,"b=",b,"c=",c)

print("running time:",time.time()-start_time)

# for a in range(0,1001):
#     for b in range(0,1001):
#         for c in range(0,1001):
#             if a**2+b**2==c**2 and a+b+c==1000:
#                 print("a=",a,"b=",b,"c=",c)
print("running time:",(time.time()-start_time))